Skip to content

Fix aux-factory lazy bounds.#10

Merged
corinnebosley merged 2 commits intocorinnebosley:lazy_bounds_testfrom
bjlittle:dask-aux-factory
Jun 7, 2017
Merged

Fix aux-factory lazy bounds.#10
corinnebosley merged 2 commits intocorinnebosley:lazy_bounds_testfrom
bjlittle:dask-aux-factory

Conversation

@bjlittle
Copy link

@bjlittle bjlittle commented Jun 5, 2017

@corinnebosley I think this is fix to maintain lazy bounds for the derived coordinate ... we need to think about testing this, but we/I/you can do that in a separate PR 😄

# extra dimension to make the shape compatible, so
# we just add an extra 1.
shape.append(1)
nd_values = np.array(nd_values)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@corinnebosley Maybe this isn't a safe thing to do ... dunno. Most likely, not.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure about this. It makes me very nervous just whipping out a safety check (wow, how Sheldon is that??).

Although since you have checked through the code path to make sure that there is no way for a non-array (i.e. a value) to appear here, I am a little happier about it.

My trigger finger is itchy, but I also have ants in my pants about this a bit. Not sure what to do...

Copy link
Author

@bjlittle bjlittle Jun 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use test coverage to convince ourselves that his is a sensible change ... Ba-zinga!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@corinnebosley I'm convinced that at this point, nd_values will always be an array (dask or numpy), as returned by _nd_points or _nd_bounds, and we've now added tests to implicitly check that, so I believe we're safe making this change (which is one of the sources of lazy data being realised)

@bjlittle bjlittle force-pushed the dask-aux-factory branch from f2cddc4 to c18d796 Compare June 7, 2017 06:53
class Test__nd_bounds(tests.IrisTest):
def test_numpy_scalar_coord__zero_ndim(self):
bounds = np.arange(2)
points = np.array(0.5)
Copy link
Owner

@corinnebosley corinnebosley Jun 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjlittle Would you mind swapping the order of points and bounds on the above two lines please? Nothing functional, just an OCD thing.

def test_numpy_scalar_coord(self):
bounds = np.arange(2).reshape(1, 2)
coord = iris.coords.AuxCoord(np.arange(1), bounds=bounds)
points = np.array(0.5)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjlittle Same here. Just feels wrong defining bounds before points.

@bjlittle bjlittle force-pushed the dask-aux-factory branch from c18d796 to 07ee9a0 Compare June 7, 2017 09:37
@corinnebosley corinnebosley merged commit 5cea2ec into corinnebosley:lazy_bounds_test Jun 7, 2017
@bjlittle bjlittle deleted the dask-aux-factory branch June 7, 2017 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants